{% extends "base_community.html" %}
{% load humanize i18n %}

{% block title %}{% firstof user_obj.profile.name user_obj.username %}{% endblock %}

{% block content-related %}
    <div role="complementary">
        <h2 id="aside-header">
            {% if user_obj == user %}
                {% translate "This is you!" %}
            {% else %}
                {% translate "Is this you?" %}
            {% endif %}
        </h2>

        <p>{% translate "Need to edit something? Here's how:" %}</p>
        <ul>
            <li><a href="{% url 'edit_profile' %}">{% translate "Edit your name and email here." %}</a></li>
            <li>{% blocktranslate trimmed %}
                The image is the <a href="https://en.gravatar.com/">Gravatar</a> linked
                to the email address you signed up with. You can change the image over
                at <a href="https://en.gravatar.com/">Gravatar</a>. If you see a robot, that's
                because you don't have a Gravatar yet.
                (Robots provided by <a href="https://robohash.org/">Robohash</a>.){% endblocktranslate %}
            </li>
            <li>{% blocktranslate trimmed %}
                The rest of the data is read-only for the time being. If you see
                outrageous errors, please file an issue on
                <a href="https://github.com/django/code.djangoproject.com/issues/new" target="_blank">GitHub</a>.{% endblocktranslate %}
            </li>
        </ul>
    </div>
{% endblock %}

{% block content %}
    <div class="user-info">
        <img class='avatar' width='150' height='150'
             src="https://secure.gravatar.com/avatar/{{ email_hash }}?s=150&amp;d=https%3A%2F%2Frobohash.org%2F{{ email_hash }}%3Fset%3Dset3%26size%3D150x150">

        <h1>
            {% firstof user_obj.profile.name user_obj.username %}
        </h1>

        {% if stats %}
            <h2>{% translate "Statistics on Django core contributions:" %}</h2>
            <ul>
                {% for stat, value in stats.items %}
                    <li>
                        {% if value.link %}<a href="{{ value.link }}">{{ stat }}: {{ value.count|intcomma }}.</a>
                        {% else %}{{ stat }}: {{ value.count|intcomma }}.
                        {% endif %}
                    </li>
                {% endfor %}
            </ul>
        {% endif %}

        {% with user_obj.owned_feeds.all as feeds %}
            {% if feeds %}
                <h2>{% translate "Community feeds:" %}</h2>
                <ul>
                    {% for f in feeds %}
                        <li><a href="{{ f.public_url }}">{{ f.title }}</a></li>
                    {% endfor %}
                </ul>
            {% endif %}
        {% endwith %}
    </div>
{% endblock content %}
